package com.doubao.doubao_admin.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.doubao.doubao_admin.common.Result;
import com.doubao.doubao_admin.model.entity.BmsBillboard;
import com.doubao.doubao_admin.service.cService.BmsBillboardService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/billboard")
public class BmsBillboardController extends BaseController {

    @Resource
    private BmsBillboardService bmsBillboardService;
    @GetMapping("show")
    @ResponseBody
    public Result<BmsBillboard> getNotices(){

        LambdaQueryWrapper<BmsBillboard> wrapper = new LambdaQueryWrapper<BmsBillboard>().eq(BmsBillboard::isShow,true);

        List<BmsBillboard> list = bmsBillboardService.list(wrapper);
        return Result.success(list.get(list.size()-1));
    }
}
